package com.qcby.chatservice.web.config;

import com.qcby.chatservice.web.interceptor.SsoAuthenticationInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * spring mvc配置
 *
 * @author cong.zhen
 * @date 2023/01/29
 */
@Component
public class SpringMvcConfiguration implements WebMvcConfigurer {

    @Resource
    private SsoAuthenticationInterceptor ssoAuthenticationInterceptor;

    /**
     * 配置SSO拦截器
     *
     * @param registry
     */

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(ssoAuthenticationInterceptor)
                .addPathPatterns("/chatService/**")
                .excludePathPatterns("/message/user/sso_token");
    }
}
